/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jse;

import java.io.File;

/**
 *
 * @author WangShuai
 */
public class FilePath {
    public static void main(String[] args) {
        //1.File List
    //        File file = new File("Z:\\hengzhi_data\\slide/public/13513");
    //        File[] files = file.listFiles();
    //        System.out.println(files.length);
    //        String[] names = file.list();
    //        for(String name : names) {
    //            System.out.println(name);
    //        }
        //2.File Separator And Path Separator
        //目录分隔符：System property file.separator,On UNIX systems the value of this field is '/'; on Microsoft Windows systems it is '\\'.
        System.out.println("Separator:" + File.separator);
        //分割多个File：System property path.separator. This character is used to separate filenames in a sequence of files given as a path list. On UNIX systems, this character is ':'; on Microsoft Windows systems it is ';'.
        System.out.println("PathSeparetor:" + File.pathSeparator);

        //3.File path  绝对路径和路径
        //已经是绝对路径，与getPath方法相同：If this abstract pathname is already absolute, then the pathname string is simply returned as if by the getPath() method.
        //否则，返回相对于user.dir的路径:If this abstract pathname is the empty abstract pathname then the pathname string of the current user directory, which is named by the system property user.dir, is returned.
        File file = new File("C:\\wamp\\images.bmp");
        file = new File("a");
        System.out.println("AbsolutePath:"+file.getAbsolutePath());
        System.out.println("Path:" + file.getPath());
    }
}
